ExtableExpand = {};
/**
 *ectable 编辑信息回跳查询
 *formId  需要刷新的表单标识
 *Uri     需要提交的路径
 */
 ExtableExpand.resetQuery = function(formId,Uri){
  var form = $("form[id='"+formId+"']");
  var obj = form.serializeArray();
  var uri = form.attr("action");
  var str = "";
  $.each(obj,function(i,o){
            if($.trim(str).length<=0){
               str = o["name"] + "=" + o["value"];
            }else{
               str = str +"&" + o["name"] + "=" + o["value"];
            }
         }
   );
  uri = uri + "?" + str;
  $(document.body).append("<form name=\"Reflection_Query_Form\" action=\""+Uri+"\" method=\"post\"/>");
  $("form[name='Reflection_Query_Form']").append("<input type=\"hidden\" name=\"_cache_url\" id=\"_cache_url\" value=\""+uri+"\" />");
  document.Reflection_Query_Form.submit();
 };
 
/**
 *ectable删除信息Ajax刷新操作
 *formId 需要刷新的表单标识 
 *Uri  需要提交的路径
 */
 ExtableExpand.resetDelete = function(formId,Uri,path){
   $.ajax({type: "post",
            dataType: "script",
            async: false,
            url:Uri,
            success: function(result){
                       var json=JSON.parse(result);
                       art.dialog({
	                       title:"提示信息：", 
	                       content:"&nbsp;&nbsp;" + json["value"], 
	                       lock:true, 
	                       width:"280px", 
	                       height:"110px", 
	                       close:function () {
	                            ExLoading("正在刷新数据，请等待",path);
	                            var cur_p=$("input[name='pres_p']");
	                            var total_pages=$("input[name='pres_totalpages']");
	                            var total_rows=$("input[name='pres_totalrows']");
	                            var cur_p=cur_p.val();
	                            var total_pages=total_pages.val();
	                            var total_rows=total_rows.val();
	                            var len=$("#pres_table_body").children().length;
	                            if(len == 1){
	                              cur_p.val((cur_p == 1 ? cur_p : cur_p - 1));
	                              total_pages.val((total_pages - 1));
	                              total_rows.val((total_rows - 1));
	                            }
	                            EXTableUtil.reload(formId);
	                            return true;
	                           },
	                       opacity:0.1}
	                       );
		            },
		    error: function(xhR, textStatus, errorThrown){alertDiv("服务器繁忙,请稍候再操作");},
		    onError: "",
		    onWait: ""
		   }
      );
 };
 
/**
 *ectable 凸显行
 *id 行标识 
 *cla 突显css类名
 */
 ExtableExpand.strikingRows = function(id,cla){
  var rows=$("tr[id='"+id+"']");
  if(rows.length > 0){
     rows.addcla(cla);
  }
  return;
 };
 
/**
 *ectable操作按钮屏蔽
 *type  button或img
 *id   需要屏蔽操作控件的标识
 *cla 屏蔽操作控件的css样式类名 
 */
 ExtableExpand.shieldOperate = function(type,id,cla){
   if(controls.length > 0){
     switch(type){
       case "a":
           var controls = $("a[id='"+id+"']");
           controls.each(function(){
              $(this).attr("href","#");
              var childrens = $(this).find(":img");
              if(childrens.length > 0){
                 childrens.each(function(){$(this).addcla(cla);});
              }
             });
           break;
       case "link":
           var controls = $("link[id='"+id+"']");
           controls.each(function(){
              $(this).attr("href","#");
              $(this).addcla(cla);
             });
           break;
        default:
           var controls = $("button[id='"+id+"']");
           controls.each(function(){
              $(this).attr("disabled",true);
              $(this).addcla(cla);
             });
           break;
     }
   }
   return;
 };